package com.dk.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dk.data.PageBean;
import com.dk.entity.DtModel;
import com.dk.mapper.DtModelMapper;
import com.dk.service.IDtModelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 回收商品型号表 服务实现类
 * </p>
 *
 * @author author
 * @since 2021-12-22
 */
@Service
public class DtModelServiceImpl  implements IDtModelService {
    @Autowired
    private DtModelMapper mapper;

    @Override
    public IPage<DtModel> getModels(Integer pageNum, Integer pageSize) {
        LambdaQueryWrapper<DtModel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
//        lambdaQueryWrapper.like(DtModel::getModel,"苹果");
        IPage<DtModel> page = new Page<>(pageNum,pageSize);
        IPage<DtModel> page1 = mapper.selectPage(page, lambdaQueryWrapper);
        return page1;
    }

    @Override
    public void add(DtModel model) {
        mapper.insert(model);
    }

    @Override
    public void delete(Integer id) {
        mapper.deleteById(id);
    }

    @Override
    public void update(DtModel model) {
        mapper.updateById(model);
    }
}
